﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataLib.Common;
using System.Data;
using Microsoft.Reporting.WebForms;
using Ewts.Code;

namespace Ewts.RDLC
{
    public partial class OutstorageSelectRDLC : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!Page.IsPostBack)
            {


               //归属地
                ListItem item = new ListItem();
                item.Text = "--请选择--";
                item.Value = "";
                string strWhere = " flag1='01' ";
                DataLib.BLL.City bllLib = new DataLib.BLL.City();
                ddlStorageName.DataSource = bllLib.GetList(strWhere);
                ddlStorageName.DataTextField = "cityname";
                ddlStorageName.DataValueField = "cityname";
                ddlStorageName.DataBind();
                ddlStorageName.Items.Insert(0, item);
            }

           
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            this.OutStorageReportView.Visible = true;  //设置页面visible：false,点击查询后为true  2013.04.17 梁玲
            string belong = ddlStorageName.SelectedValue;
            string loadnum = txtLoadnum.Text;
            string outStorageNO = txtOutStorageNo.Text;
            string startdate = txtTime1.Text;
            string enddate = txtTime2.Text;
            string customer = txtCum.Text;
            string gCode = txtGoodsCode.Text;
            string gName = txtGoodsName.Text;
            string position = txtPosition.Text;
            string barcode = txtBarCode.Text;
            string ConsumMan = txtConsumMan.Text;
            string boxid = txtBOXID.Text;

            DataTable dt = new DataLib.BLL.OutStorage().getDtByUnionWhere(belong,loadnum,
                                    outStorageNO,"",gCode,
                                    startdate,enddate,barcode,ConsumMan,boxid,customer,"",gName,position);

            ReportDataSource rds = new ReportDataSource("OutStorageSelectDS", dt);
            OutStorageReportView.LocalReport.DataSources.Clear();
            OutStorageReportView.LocalReport.DataSources.Add(rds);
            new RDLCPrinter().FillRow(dt, 3, 20,20);
            OutStorageReportView.LocalReport.Refresh();


        }
    }
}